package com.distribution.system.openapi.config;

import com.distribution.system.openapi.interceptor.SignInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: GodLu
 * @create: 2024-04-16 22:50
 * @description: 签名拦截器配置类
 */
@Configuration
public class SignInterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(signInterceptor()).addPathPatterns("/api/sparkPlan1/**");//拦截指定路径前缀的接口
    }
    //交给spring管理 SignInterceptor bean
    //不然下边 private OpenApiApplyMapper applyMapper;注入为null
    @Bean
    public SignInterceptor signInterceptor(){
        return new SignInterceptor();
    }

}
